1. Technical Field
This invention generally relates to object oriented programming and more specifically relates to a mechanism and method allowing flexible retrieval of attribute values in an object oriented framework.
2. Background Art
The development of the EDVAC computer system of 1948 is often cited as the beginning of the computer era. Since that time, computer systems have evolved into extremely sophisticated devices, and computer systems may be found in many different settings. Computer systems typically include a combination of hardware, such as semiconductors and circuit boards, and software, also known as computer programs. As advances in semiconductor processing and computer architecture push the performance of the computer hardware higher, more sophisticated computer software has evolved to take advantage of the higher performance of the hardware, resulting in computer systems today that are much more powerful than just a few years ago.
Computer systems typically include operating system software that controls the basic function of the computer, and one or more software application programs that run under the control of the operating system to perform desired tasks. For example, a typical IBM Personal Computer may run the OS/2 operating system, and under the control of the OS/2 operating system, a user may execute an application program, such as a word processor. As the capabilities of computer systems have increased, the application software programs designed for high performance computer systems have become extremely powerful. Additionally, software development costs have continued to rise because more powerful and complex programs take more time, and hence more money, to produce.
One way in which the performance of application software programs has been improved while the associated development costs have been reduced is by using object oriented programming concepts. The goal of using object oriented programming is to create small, reusable sections of program code known as xe2x80x9cobjectsxe2x80x9d that can be quickly and easily combined and re-used to create new programs. This is similar to the idea of using the same set of building blocks again and again to create many different structures. The modular and re-usable aspects of objects will typically speed development of new programs, thereby reducing the costs associated with the development cycle. In addition, by creating and re-using a comprehensive set of well-tested objects, a more stable, uniform, and consistent approach to developing new computer programs can be achieved.
A central concept in object oriented programming is the xe2x80x9cclass.xe2x80x9d A class is a template that defines a type of object. A class outlines or describes the characteristics or makeup of objects that belong to that class. By defining a class, objects can be created that belong to the class without having to rewrite the entire definition for each new object. This feature of object oriented programming promotes the reusability of existing object definitions and promotes more efficient use of program code.
Frameworks are relatively recent developments in object oriented programming that provide a group of pre-packaged classes and class relationships that are designed to help a user easily extend the framework to write a particular software program, such as a software application. Frameworks typically define certain core functions that cannot be changed by a programmer using the framework, and allow the programmer to extend the framework at defined extension points to generate a custom software application in much less time than coding the software application from scratch.
One capability that is often needed in computer programs is the ability to use one piece of information (or attribute) to retrieve another piece of information (or attribute). This capability is generally known as xe2x80x9ckeyingxe2x80x9d, where one attribute is used as a xe2x80x9ckeyxe2x80x9d, or index, to locate and retrieve a different attribute. One known method for keying uses a lookup table that pairs each key to it""s corresponding attribute value. When a client program needs to access the attribute value, it uses the corresponding key to locate the attribute value in the lookup table.
Another method for attribute retrieval using keys in an object oriented program could assign attributes to objects, and could implement a sequential search algorithm to search through a sequence of objects until the corresponding attribute is located. While this approach may work for very simplistic programs, it would not be suitable for object oriented programs of any level of significance or complexity due to the performance implications of sequentially searching through a large number of objects to locate an attribute. In addition, this approach is not flexible and cannot easily be adapted to new requirements. For example, storing an attribute in an object does not account for the situation where combinations of attributes need to be represented. Of course, a class could be defined for a combination of two or more attributes. But each combination would require a new class definition. For an object oriented program of any complexity, the number of classes quickly grows to an unacceptable level. And even if a large number of classes are defined for many different combinations, the above method still requires the generation of new classes for each new combination.
Providing classes that represent combinations of attributes might work in an environment where the behavior is predictable. However, when frameworks are used, the behavior of the framework is determined by a programmer that extends the framework to define a software application. It is therefore impossible to pre-determine what combination classes might be needed to define combinations of attributes. Certain aspects of some applications are so variable that providing combination classes in a framework is an unworkable solution. For example, in an order processing framework, the calculation of price or discount will vary widely from one company to the next. What is needed is a flexible way to retrieve attribute values in an object oriented environment. Without improved mechanisms and methods for retrieving attribute values, the computer industry will continue to suffer from object oriented frameworks that do not provide the desired flexibility, functionality, and performance.
In an object oriented computer system, a framework mechanism defines an infrastructure for allowing a user to flexibly define keys and their corresponding attributes. A special type of key called a specification key allows combinations of attributes to be specified, as well as set and range capabilities. An attribute retrieval policy is defined by a programmer to specify an algorithm or criteria that is used to calculating the desired attribute value. An attribute key controller contains key/value pairings for the attribute, contains the attribute retrieval policy, provides a maintenance interface for changing the attribute values; and provides a client interface for retrieving the attribute according to the attribute retrieval policy. The framework thus allows a user great flexibility in defining a suitable key/attribute retrieval mechanism by defining a suitable policy, defining one or more specification keys, and defining an associated controller.